using MyServer.Middlewares;
using MyServer.Todo.ClientAPI.Extensions.ConfigureService;

var builder = WebApplication.CreateBuilder(args);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
builder.Services.ConfigureServices(builder.Configuration);

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
app.UseRouting();
app.UseMiddleware<ExceptionHandlerMiddleware>();
//app.UseAuthorization();
app.UseCors("default");
app.UseEndpoints(endpoints =>
{
    endpoints.MapControllers();
});
app.Run();
